package xyz.csmemo.novel.service;

import jakarta.validation.Valid;
import xyz.csmemo.novel.core.common.req.PageReqDto;
import xyz.csmemo.novel.core.common.resp.PageRespDto;
import xyz.csmemo.novel.core.common.resp.RestResp;
import xyz.csmemo.novel.dto.req.BookAddReqDto;
import xyz.csmemo.novel.dto.req.ChapterAddReqDto;
import xyz.csmemo.novel.dto.req.ChapterUpdateReqDto;
import xyz.csmemo.novel.dto.req.UserCommentReqDto;
import xyz.csmemo.novel.dto.resp.*;

import java.security.NoSuchAlgorithmException;
import java.util.List;

public interface BookService {
    RestResp<List<BookCategoryRespDto>> listCategory(Integer workDirection);

    RestResp<BookInfoRespDto> getBookById(Long bookId);

    RestResp<Void> addVisitCount(Long bookId);

    RestResp<BookChapterAboutRespDto> getLastChapterAbout(Long bookId);

    RestResp<List<BookInfoRespDto>> listRecBooks(Long bookId) throws NoSuchAlgorithmException;

    RestResp<List<BookChapterRespDto>> listChapters(Long bookId);

    RestResp<BookContentAboutRespDto> getBookContentAbout(Long chapterId);

    RestResp<Long> getPreChapterId(Long chapterId);

    RestResp<Long> getNextChapterId(Long chapterId);

    RestResp<List<BookRankRespDto>> listVisitRankBooks();

    RestResp<List<BookRankRespDto>> listNewestRankBooks();

    RestResp<List<BookRankRespDto>> listUpdateRankBooks();

    RestResp<BookCommentRespDto> listNewestComments(Long bookId);

    RestResp<Void> saveComment(@Valid UserCommentReqDto dto);

    RestResp<Void> updateComment(Long userId, Long id, String content);

    RestResp<Void> deleteComment(Long userId, Long id);

    RestResp<PageRespDto<UserCommentRespDto>> listComments(Long userId, PageReqDto pageReqDto);

    RestResp<Void> saveBook(@Valid BookAddReqDto dto);

    RestResp<PageRespDto<BookInfoRespDto>> listAuthorBooks(PageReqDto dto);

    RestResp<Void> saveBookChapter(@Valid ChapterAddReqDto dto);

    RestResp<Void> deleteBookChapter(Long chapterId);

    RestResp<ChapterContentRespDto> getBookChapter(Long chapterId);

    RestResp<Void> updateBookChapter(Long chapterId, @Valid ChapterUpdateReqDto dto);

    RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(Long bookId, PageReqDto dto);
}
